import 'package:oramemo/generated/json/base/json_convert_content.dart';
import 'package:oramemo/entity/device_mine_entity.dart';

DeviceMineEntity $DeviceMineEntityFromJson(Map<String, dynamic> json) {
  final DeviceMineEntity deviceMineEntity = DeviceMineEntity();
  final String? msg = jsonConvert.convert<String>(json['msg']);
  if (msg != null) {
    deviceMineEntity.msg = msg;
  }
  final int? code = jsonConvert.convert<int>(json['code']);
  if (code != null) {
    deviceMineEntity.code = code;
  }
  final List<DeviceMineData>? data = (json['data'] as List<dynamic>?)
      ?.map(
          (e) => jsonConvert.convert<DeviceMineData>(e) as DeviceMineData)
      .toList();
  if (data != null) {
    deviceMineEntity.data = data;
  }
  return deviceMineEntity;
}

Map<String, dynamic> $DeviceMineEntityToJson(DeviceMineEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['msg'] = entity.msg;
  data['code'] = entity.code;
  data['data'] = entity.data?.map((v) => v.toJson()).toList();
  return data;
}

extension DeviceMineEntityExtension on DeviceMineEntity {
  DeviceMineEntity copyWith({
    String? msg,
    int? code,
    List<DeviceMineData>? data,
  }) {
    return DeviceMineEntity()
      ..msg = msg ?? this.msg
      ..code = code ?? this.code
      ..data = data ?? this.data;
  }
}

DeviceMineData $DeviceMineDataFromJson(Map<String, dynamic> json) {
  final DeviceMineData deviceMineData = DeviceMineData();
  final String? createTime = jsonConvert.convert<String>(json['createTime']);
  if (createTime != null) {
    deviceMineData.createTime = createTime;
  }
  final DeviceMineDataParams? params = jsonConvert.convert<
      DeviceMineDataParams>(json['params']);
  if (params != null) {
    deviceMineData.params = params;
  }
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    deviceMineData.id = id;
  }
  final int? deviceId = jsonConvert.convert<int>(json['deviceId']);
  if (deviceId != null) {
    deviceMineData.deviceId = deviceId;
  }
  final int? userId = jsonConvert.convert<int>(json['userId']);
  if (userId != null) {
    deviceMineData.userId = userId;
  }
  final int? status = jsonConvert.convert<int>(json['status']);
  if (status != null) {
    deviceMineData.status = status;
  }
  final int? operId = jsonConvert.convert<int>(json['operId']);
  if (operId != null) {
    deviceMineData.operId = operId;
  }
  final String? terminalId = jsonConvert.convert<String>(json['terminalId']);
  if (terminalId != null) {
    deviceMineData.terminalId = terminalId;
  }
  final String? deviceName = jsonConvert.convert<String>(json['deviceName']);
  if (deviceName != null) {
    deviceMineData.deviceName = deviceName;
  }
  final int? deviceRelationId = jsonConvert.convert<int>(
      json['deviceRelationId']);
  if (deviceRelationId != null) {
    deviceMineData.deviceRelationId = deviceRelationId;
  }
  final int? devicePermission = jsonConvert.convert<int>(
      json['devicePermission']);
  if (devicePermission != null) {
    deviceMineData.devicePermission = devicePermission;
  }
  final DeviceMineDataDevice? device = jsonConvert.convert<
      DeviceMineDataDevice>(json['device']);
  if (device != null) {
    deviceMineData.device = device;
  }
  return deviceMineData;
}

Map<String, dynamic> $DeviceMineDataToJson(DeviceMineData entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['createTime'] = entity.createTime;
  data['params'] = entity.params?.toJson();
  data['id'] = entity.id;
  data['deviceId'] = entity.deviceId;
  data['userId'] = entity.userId;
  data['status'] = entity.status;
  data['operId'] = entity.operId;
  data['terminalId'] = entity.terminalId;
  data['deviceName'] = entity.deviceName;
  data['deviceRelationId'] = entity.deviceRelationId;
  data['devicePermission'] = entity.devicePermission;
  data['device'] = entity.device?.toJson();
  return data;
}

extension DeviceMineDataExtension on DeviceMineData {
  DeviceMineData copyWith({
    String? createTime,
    DeviceMineDataParams? params,
    int? id,
    int? deviceId,
    int? userId,
    int? status,
    int? operId,
    String? terminalId,
    String? deviceName,
    int? deviceRelationId,
    int? devicePermission,
    DeviceMineDataDevice? device,
  }) {
    return DeviceMineData()
      ..createTime = createTime ?? this.createTime
      ..params = params ?? this.params
      ..id = id ?? this.id
      ..deviceId = deviceId ?? this.deviceId
      ..userId = userId ?? this.userId
      ..status = status ?? this.status
      ..operId = operId ?? this.operId
      ..terminalId = terminalId ?? this.terminalId
      ..deviceName = deviceName ?? this.deviceName
      ..deviceRelationId = deviceRelationId ?? this.deviceRelationId
      ..devicePermission = devicePermission ?? this.devicePermission
      ..device = device ?? this.device;
  }
}

DeviceMineDataParams $DeviceMineDataParamsFromJson(Map<String, dynamic> json) {
  final DeviceMineDataParams deviceMineDataParams = DeviceMineDataParams();
  return deviceMineDataParams;
}

Map<String, dynamic> $DeviceMineDataParamsToJson(DeviceMineDataParams entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  return data;
}

extension DeviceMineDataParamsExtension on DeviceMineDataParams {
}

DeviceMineDataDevice $DeviceMineDataDeviceFromJson(Map<String, dynamic> json) {
  final DeviceMineDataDevice deviceMineDataDevice = DeviceMineDataDevice();
  final String? updateTime = jsonConvert.convert<String>(json['updateTime']);
  if (updateTime != null) {
    deviceMineDataDevice.updateTime = updateTime;
  }
  final DeviceMineDataDeviceParams? params = jsonConvert.convert<
      DeviceMineDataDeviceParams>(json['params']);
  if (params != null) {
    deviceMineDataDevice.params = params;
  }
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    deviceMineDataDevice.id = id;
  }
  final int? deviceType = jsonConvert.convert<int>(json['deviceType']);
  if (deviceType != null) {
    deviceMineDataDevice.deviceType = deviceType;
  }
  final String? deviceNo = jsonConvert.convert<String>(json['deviceNo']);
  if (deviceNo != null) {
    deviceMineDataDevice.deviceNo = deviceNo;
  }
  final String? deviceName = jsonConvert.convert<String>(json['deviceName']);
  if (deviceName != null) {
    deviceMineDataDevice.deviceName = deviceName;
  }
  final String? deviceSn = jsonConvert.convert<String>(json['deviceSn']);
  if (deviceSn != null) {
    deviceMineDataDevice.deviceSn = deviceSn;
  }
  final String? deviceTelnum = jsonConvert.convert<String>(
      json['deviceTelnum']);
  if (deviceTelnum != null) {
    deviceMineDataDevice.deviceTelnum = deviceTelnum;
  }
  final int? deviceGear = jsonConvert.convert<int>(json['deviceGear']);
  if (deviceGear != null) {
    deviceMineDataDevice.deviceGear = deviceGear;
  }
  final String? deviceConfig = jsonConvert.convert<String>(
      json['deviceConfig']);
  if (deviceConfig != null) {
    deviceMineDataDevice.deviceConfig = deviceConfig;
  }
  final String? heartTime = jsonConvert.convert<String>(json['heartTime']);
  if (heartTime != null) {
    deviceMineDataDevice.heartTime = heartTime;
  }
  final String? devicePosition = jsonConvert.convert<String>(
      json['devicePosition']);
  if (devicePosition != null) {
    deviceMineDataDevice.devicePosition = devicePosition;
  }
  final String? deviceAddress = jsonConvert.convert<String>(
      json['deviceAddress']);
  if (deviceAddress != null) {
    deviceMineDataDevice.deviceAddress = deviceAddress;
  }
  final String? deviceQuantity = jsonConvert.convert<String>(
      json['deviceQuantity']);
  if (deviceQuantity != null) {
    deviceMineDataDevice.deviceQuantity = deviceQuantity;
  }
  final String? deviceVoltage = jsonConvert.convert<String>(
      json['deviceVoltage']);
  if (deviceVoltage != null) {
    deviceMineDataDevice.deviceVoltage = deviceVoltage;
  }
  final int? deviceModel = jsonConvert.convert<int>(json['deviceModel']);
  if (deviceModel != null) {
    deviceMineDataDevice.deviceModel = deviceModel;
  }
  final int? customModelId = jsonConvert.convert<int>(json['customModelId']);
  if (customModelId != null) {
    deviceMineDataDevice.customModelId = customModelId;
  }
  return deviceMineDataDevice;
}

Map<String, dynamic> $DeviceMineDataDeviceToJson(DeviceMineDataDevice entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['updateTime'] = entity.updateTime;
  data['params'] = entity.params?.toJson();
  data['id'] = entity.id;
  data['deviceType'] = entity.deviceType;
  data['deviceNo'] = entity.deviceNo;
  data['deviceName'] = entity.deviceName;
  data['deviceSn'] = entity.deviceSn;
  data['deviceTelnum'] = entity.deviceTelnum;
  data['deviceGear'] = entity.deviceGear;
  data['deviceConfig'] = entity.deviceConfig;
  data['heartTime'] = entity.heartTime;
  data['devicePosition'] = entity.devicePosition;
  data['deviceAddress'] = entity.deviceAddress;
  data['deviceQuantity'] = entity.deviceQuantity;
  data['deviceVoltage'] = entity.deviceVoltage;
  data['deviceModel'] = entity.deviceModel;
  data['customModelId'] = entity.customModelId;
  return data;
}

extension DeviceMineDataDeviceExtension on DeviceMineDataDevice {
  DeviceMineDataDevice copyWith({
    String? updateTime,
    DeviceMineDataDeviceParams? params,
    String? id,
    int? deviceType,
    String? deviceNo,
    String? deviceName,
    String? deviceSn,
    String? deviceTelnum,
    int? deviceGear,
    String? deviceConfig,
    String? heartTime,
    String? devicePosition,
    String? deviceAddress,
    String? deviceQuantity,
    String? deviceVoltage,
    int? deviceModel,
    int? customModelId,
  }) {
    return DeviceMineDataDevice()
      ..updateTime = updateTime ?? this.updateTime
      ..params = params ?? this.params
      ..id = id ?? this.id
      ..deviceType = deviceType ?? this.deviceType
      ..deviceNo = deviceNo ?? this.deviceNo
      ..deviceName = deviceName ?? this.deviceName
      ..deviceSn = deviceSn ?? this.deviceSn
      ..deviceTelnum = deviceTelnum ?? this.deviceTelnum
      ..deviceGear = deviceGear ?? this.deviceGear
      ..deviceConfig = deviceConfig ?? this.deviceConfig
      ..heartTime = heartTime ?? this.heartTime
      ..devicePosition = devicePosition ?? this.devicePosition
      ..deviceAddress = deviceAddress ?? this.deviceAddress
      ..deviceQuantity = deviceQuantity ?? this.deviceQuantity
      ..deviceVoltage = deviceVoltage ?? this.deviceVoltage
      ..deviceModel = deviceModel ?? this.deviceModel
      ..customModelId = customModelId ?? this.customModelId;
  }
}

DeviceMineDataDeviceParams $DeviceMineDataDeviceParamsFromJson(
    Map<String, dynamic> json) {
  final DeviceMineDataDeviceParams deviceMineDataDeviceParams = DeviceMineDataDeviceParams();
  return deviceMineDataDeviceParams;
}

Map<String, dynamic> $DeviceMineDataDeviceParamsToJson(
    DeviceMineDataDeviceParams entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  return data;
}

extension DeviceMineDataDeviceParamsExtension on DeviceMineDataDeviceParams {
}